fix(view): fix pjax support for mathjax #1334
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
修复问题
#1327 :使用 pjax 时 MathJax 未在新页面重新加载,从而导致数学公式无法在新页面渲染。
解决方案
监听
pjax:complete
事件。当该事件触发时,判断是否已导入 MathJax。如果已导入,则调用 MathJax 的typesetPromise()
方法来重新渲染数学公式。Problem Fixed
#1327 : Math formulas not rendered in new pages because pjax banned the reloading of MathJax.
Solution
Listen on
pjax:complete
event. When the event triggered, see whether MathJax has been imported, then invoketypesetPromise()
to re-render math formulas.